﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Fast.Framework.Models;

namespace Fast.Framework.Web.Test
{

    /// <summary>
    /// 存储库接口类
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public interface IRepository<T> where T : class
    {

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体对象</param>
        Task<int> Add(T entity);

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="list">集合</param>
        Task<int> Add(IEnumerable<T> list);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns></returns>
        Task<int> Delete(object id);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns></returns>
        Task<int> Delete(IEnumerable<object> id);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体对象</param>
        Task<int> Update(T entity);

        /// <summary>
        /// 获取根据ID
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns></returns>
        Task<T> GetById(object id);

        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAll();
    }
}
